package com.you.atlas.web.member.module.screen;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.Navigator;
import com.alibaba.citrus.turbine.dataresolver.Param;
import com.you.atlas.biz.member.service.AccountBindService;
import com.you.atlas.biz.member.service.FollowQueryService;
import com.you.common.ibatis.data.DataList;
import com.you.common.webx.AuthContext;
import com.you.member.biz.service.FeedService;
import com.you.member.biz.service.MemberQueryService;
import com.you.member.biz.service.NotifyService;
import com.you.member.dal.dao.dataobject.AccountBindDO;
import com.you.member.dal.dao.dataobject.MemberDO;

public class Me {

    @Autowired
    private MemberQueryService memberQueryService;

    @Autowired
    private FeedService        feedService;

    @Autowired
    private FollowQueryService followQueryService;

    @Autowired
    private NotifyService      notifyService;

    @Autowired
    private AccountBindService accountBindService;

    public void execute(@Param(name = "pageNo") int pageNo, Context context, Navigator navigator) {
        Long memberId = AuthContext.getContext().getMemberId();
        MemberDO memberDO = memberQueryService.find(memberId);
        context.put("memberDO", memberDO);
        context.put("fans", followQueryService.countFans(memberId));
        context.put("follow", followQueryService.countFollow(memberId));
        DataList feedList = feedService.queryFeed(pageNo, memberId);
        context.put("feedList", feedList);
        Long count = notifyService.countNotify(memberId);
        context.put("notifyCount", count);
        
        AccountBindDO  accountBind = accountBindService.findByMemberId(memberId);
        context.put("accountBind", accountBind);
    }
}
